<!DOCTYPE html>
<html lang="en">
<script type="text/javascript">
    var dire = 'user';
    var thumb = 'big_thumb,middle_thumb,small_thumb';
    var fileNumLimit = 1;
</script>

<head>
    <{include file="header.html" }>
        <title>网课科目设置-网课科目管理-
            <{$user_data[ 'school_name']}>-德安信会计在线教育平台</title>
        <link href="/static/public/webupload/webuploader.css" rel="stylesheet">
</head>

<body>
    <div class="wrap">
        <!--star left-->
        <div class="column">
            <{include file="left_menu.html" }>
        </div>
        <div id="ContMianBox">
            <!--star子栏目-->
            <div class="sub-colum">
                <div class="tit"><{$left_menu_min.menu}></div>
                <ul>
                    <{foreach from=$left_menu_min.list item=item}>
                    <li <{if $item['url'] == $left_menu_min.curr}>class="curr"<{/if}>><a href="<{$item['url']}>"><{$item['name']}></a></li>
                    <{/foreach}>
                </ul>
            </div>
            <!--end子栏目-->
            <!--end left-->
            <div class="container narrow">
                <!--star conter-->
                <div class="cetContent">
                    <div class="tit p-lr20">
                       <span><a href="/course_zhibo">直播课</a></span>
                        <span class="curr"><a href="/course_zhibo/cate_subject_list">直播课科目</a></span>
                        <span><a href="/course_zhibo/cate_list">直播课分类</a></span>
                    </div>
                </div>
                <!--star内容区域-->
                <div class="mainScroll">
                    <div class="mainContainer line-all">
                        <!--star tabMainCont-->
                        <div class="line-all p20">
                            <form class="layui-form" method="post" action="<{$post_url}>" onsubmi="return false" id="form_add_video_course">
                                <input type="hidden" name="id" value="<{$info.id|default:'0'}>" />
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">科目名称</label>
                                        <div class="layui-input-block">
                                            <input type="text" value="<{$info.name|default:''}>" name="name" placeholder="请输入标题" lay-verify="required" autocomplete="off" class="layui-input" style="width: 800px;">
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">排序</label>
                                        <div class="layui-input-block">
                                            <input type="text" value="<{$info.sort|default:0}>" name="sort" placeholder="请输入排序" lay-verify="required" autocomplete="off" class="layui-input" style="width: 300px;">
                                        </div>
                                    </div>
                                </div>
                               
                                 <div class="layui-form-item">
                                    <label class="layui-form-label">所属分类：</label>
                                    
                                    <div class="layui-input-inline">
                                        <select name="pid" lay-verify="required" id="cate_id" placeholder="请选择" lay-filter="subject">
                                            <option value="">所属分类</option>
                                            <{foreach from=$cate item=item}>
                                                <option value="<{$item.id}>" <{if $info['pid']|default:"" eq $item.id}>selected="selected"<{/if}>><{$item.name}></option>
                                            <{/foreach}>
                                        </select>
                                    </div>
                                    <div class="layui-form-mid layui-word-aux"><{if empty($cate)}>还没有课程分类，请<a href="/course/cate_publish" class="c-52a1fa">添加课程分类</a><{/if}></div>
                                </div>
                                
                                <div class="layui-form-item">
                                    <label class="layui-form-label">启用：</label>
                                    <div class="layui-input-inline">
                                        <select name="status" lay-verify="required" id="subject" placeholder="请选择" lay-filter="subject">
                                                <option <{if $info['status']|default:"" eq 1}>selected="selected"<{/if}> value="1">是</option>
                                                <option <{if $info['status']|default:"" eq 0}>selected="selected"<{/if}> value="0">否</option>
            							</select>
                                    </div>
                                </div>

                                <div class="layui-form-item layui-form-text">
                                    <label class="layui-form-label">科目介绍：</label>
                                    <div class="layui-input-block">
                                        <textarea name="content" placeholder="请输入科目介绍" class="layui-textarea"><{$info.content|default:''}></textarea>
                                    </div>
                                </div>
                                <div class="layui-input-block">
                                    <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
                                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                </div>
                            </form>
                            <!--end tabMainCont-->
                        </div>

                    </div>
                </div>
                <!--end内容区域-->
                <{include file="footer.html"}>
                <script>
                    layui.use(['form','laydate','jquery'], function() {
                        var form = layui.form();
                      form.on('select(type)', function(data){
                                var ii = layer.load();
                                var id = data.value;

                                $("#cate_id").html('<option value="">请选择所属分类</option>');
                                form.render('select');
                                $.ajax({
                                    type: "POST",
                                    url: "/course/get_cate_list_ajax/"+id,
                                    
                                    dataType: "json",
                                    success: function (data) {
                                        // var ddl = $("#subject");
                                        var html ='<option value="">请选择所属分类</option>';
                                        $(data).each(function (key) {
                                            html += "<option value='"+data[key].id+"'>"+data[key].name+"</option>";
                                        });
                                        $("#cate_id").html(html);
                                        form.render('select');
                                        layer.close(ii);
                                    }
                                });
                            }); 

                    });
                </script>
